The present invention relates to a focus position detecting method appropriate for an apparatus requiring focusing in picking up an image by means of an optical system lens in, for example, an aligner for semiconductor devices in which the optimum optical position of a positioning mark is made to be automatically adjusted in detecting the positions of a reticle and the aligner, and the positions of a wafer and the aligner.
In a conventional automatic focusing device or method, image data obtained by picking up an image is differentiated to form an evaluation function by utilizing the differentiated image data, and an optical position in which the evaluation function takes its extreme value among a variety of optical positions is determined to be the focus position. The evaluation function has been obtained in such forms as the maximum value of the absolute values of the differentiated image data, the sum of the absolute values of the differentiated image data being expressed by ##EQU1## or the sum of square values of the absolute values of the differentiated image data being expressed by ##EQU2## (where Dn is the absolute value of the differentiated image data, and n is an index corresponding to the addresses of all the pixels in a frame of an image or a window) (refer to Japanese Laid-Open Patent Publication No. 62-272216).
Describing in detail the above-mentioned method, gray-level data of pixels of an object image are firstly obtained from an output (video signal) of an image input device such as a video camera. As shown in FIG. 11, pixel gray-level data a, b, c, . . . corresponding to the pixels of the object image are obtained.
Then, as shown by a dotted rectangle in FIG. 11, a partial image 60 composed of 1.times.3 =3 pixels a, b, and c including a target pixel b is set up and then subjected to a differentiating process. The differentiating process is practically executed by a filtering process by means of a coefficient matrix composed of one column by three rows as shown in FIG. 13.
When the coefficient matrix as shown in FIG. 13 is used, there is derived a difference between the gray-level data a of the pixel positioned on the left side of the target pixel on a detection line and the gray-level data b of the pixel positioned on the right side of the target pixel on the detection line. The processing as shown in FIG. 13 can be expressed by the following expression. EQU Calculation result=[c]-[a]
When the processing of the partial image 60 is completed, the partial image is shifted sidewise by one pixel to set up a partial image 61 which excludes the pixel a and instead includes a pixel d positioned on the right side, and the same processing as described above is executed. When the processing is completed, the same processing is repetitively executed each time by shifting the partial image by one pixel to successively execute extraction processing.
Then, an evaluation function as described above is calculated by means of the thus obtained differentiated image data, and, after changing the optical position with respect to the object, the aforementioned processing is executed to calculate the evaluation function. The above-mentioned operation is executed by successively changing the optical position with respect to the object, and thus the position in which the evaluation function takes its extreme value is determined to be the focus position.
Unfortunately, the aforementioned conventional method of forming an evaluation function by means of differentiated image data has the following disadvantages.
It is assumed that pixel gray-level data A, B, C, . . . as shown in FIG. 12 are obtained as a result of the variation in quantity of light in spite of the fact that the object and the optical position with respect to the object are the same as in FIG. 11. When the gray-level data of the partial image 60 as shown in FIG. 11 and the gray-level data of a partial image 62 as shown in FIG. 12 are respectively as shown in FIGS. 14 and 15, there is a double contrast (gray-level difference) between the left area and the right area of the target pixel on the detection line in each case, and therefore the gray-level difference is visually quite conspicuous in the image.
In regard to the above, the calculation result is 20 in the case of the partial image 60 (FIG. 14), while the calculation result is 40 in the case of the partial image 62 (FIG. 15), meaning that the calculation results are different from each other doubly in magnitude to result in a great difference between the values of the evaluation functions. Although the above-mentioned example is an extreme case, the quantity of light for illuminating the object varies in picking up the image of the object by successively changing the optical position with respect to the object to detect the focus position. As a result, when the evaluation function has a varied value, the variation exerts great influence on the detection accuracy. Referring to the variation in gray-level caused by the variation in quantity of light as the "major gray-level variation", when the evaluation function is dependent on the major gray-level variation even in an identical optical position, the detection accuracy of the focus position is reduced to result in deteriorating the reproducibility.
As a countermeasure for the above, it can be also considered to automatically vary the evaluation function according to the degree of the variation in quantity of light. However, when a routine for surely sensing the variance in quantity of light and automatically varying the evaluation function is incorporated, a complicated processing algorithm is required to result in consuming much time in the extraction stage soon as to loose practicability.